function getFromCookie(c_name){
	if (document.cookie.length > 0){
		c_start=document.cookie.indexOf(c_name + "=");//通过String对象的indexOf()来检查这个cookie是否存在，不存在就为 -1　　
　　　　　　if (c_start!=-1){ 
　　　　　　　　c_start=c_start + c_name.length+1;//最后这个+1其实就是表示"="号啦，这样就获取到了cookie值的开始位置
　　　　　　　　c_end=document.cookie.indexOf(";",c_start);//其实我刚看见indexOf()第二个参数的时候猛然有点晕，后来想起来表示指定的开始索引的位置...这句是为了得到值的结束位置。因为需要考虑是否是最后一项，所以通过";"号是否存在来判断
　　　　　　　　if (c_end==-1) c_end=document.cookie.length;
　　　　　　　　return unescape(document.cookie.substring(c_start,c_end));//通过substring()得到了值。想了解unescape()得先知道escape()是做什么的，都是很重要的基础，想了解的可以搜索下，在文章结尾处也会进行讲解cookie编码细节
　　　　　　} 
	}
	return "";
}

function setCookie(c_name, value, expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function setCookieTime(c_name, value, expires){
	var exdate=new Date();
	exdate.setTime(exdate.getTime()+expires);
	document.cookie=c_name+ "=" + escape(value) + ((expires==null) ? "" : ";expires="+exdate.toGMTString());
}

function workMenu(){
	if (false && null == $("#WorkMenuSelect")[0].firstChild){
		var $k9z8p1d6p1d6 = [
			//["CatalogerWorkMenuOrA","归类工作菜单",""],
			["CatalogerWorkMenuOrB","归类工作菜单",""]
			//["ItemCurrentDocPages","归类浏览菜单",""],
			//["MrDocPageTypeOr","归类浏览菜单",""]
		];
	
		var $s = "";
		for (var i = 0;i < $k9z8p1d6p1d6.length;i++){
			if ($k9z8p1d6p1d6[i][0] == this.$q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1()){
				$k9z8p1d6p1d6[i][2] = "selected";
			}
			$s += "<option value=\""+$k9z8p1d6p1d6[i][0]+"\" "+$k9z8p1d6p1d6[i][2]+">"+$k9z8p1d6p1d6[i][1]+"</option>";
		}
		$("#WorkMenuSelect").html($s);
	
		$("#WorkMenuSelect").on({
				"change":function(){
					var $v = $(this).val();
					this.$q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1 = $v;
				
					setCookie("MediDocumenter_WorkMenu",$v,732);//732:day
				
					workMenu();
				}
			}
		);
	}
	
	if ("CatalogerWorkMenuOrA" == this.$q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1()){
		$("#WorkMenuBody").html("<div id=\"CatalogerWorkMenuOrA\"></div>");
		catalogerWorkMenuOrA($("#CatalogerWorkMenuOrA")[0]).$p4j5x1j5k9g0u5g5();
	}else if ("CatalogerWorkMenuOrB" == this.$q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1()){
		$("#WorkMenuBody").html("<div id=\"CatalogerWorkMenuOrB\"></div>");
		catalogerWorkMenuOrB($("#CatalogerWorkMenuOrB")[0]).$p4j5x1j5k9g0u5g5();
	}else if ("ItemCurrentDocPages" == this.$q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1()){
		$("#WorkMenuBody").html("<div id=\"ItemCurrentDocPages\"></div>");
		itemCurrentDocPages();
	}else if ("MrDocPageTypeOr" == this.$q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1()){
		$("#WorkMenuBody").html("<div id=\"MrDocPageTypeOr\"></div>");
		mrDocPageTypeOr();
	}
	
	//this.activiteone();////
};

function $q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1(){
	var $r = getFromCookie("MediDocumenter_WorkMenu");
	if (isUse($r)){
		return "CatalogerWorkMenuOrB";
	}
	return "CatalogerWorkMenuOrB";
};

//注释：循环产生button
function catalogerWorkMenuOrA(scanerSettingBtn){
	scanerSettingBtn.$h3k9t2p8a1n4t2 = function($k9z8u5g5){// 注释：注释
		if ($.type($k9z8u5g5) === "number"){
			var $s = "";
			
			var $x1k3p4t2q6p1x1t2s5 = Scan.MrPageTypeList[$k9z8u5g5];
			$s += "<div class=\"itemOnePageType\" __q1t7k3u5u5=\"itemOnePageType\"" +
				" __a7k3t7I1t2=\""+$x1k3p4t2q6p1x1t2s5.code+"\">"+
					this.$h3n4n4t2f9j6k9t2p8a1n4t2($x1k3p4t2q6p1x1t2s5)+
				"</div>";
			//alert($s);
			return $s;
		} 
	};
	
	scanerSettingBtn.$h3n4n4t2f9j6k9t2p8a1n4t2 = function($x1k3p4t2q6p1x1t2s5,$u5o8s5q5t2){
		if ($.type($x1k3p4t2q6p1x1t2s5) === "string"){
			var $p8j5t7c6x1j5k9g0 = $x1k3p4t2q6p1x1t2s5;
			$x1k3p4t2q6p1x1t2s5 = getb7k3p4t2q6p1x1t2($p8j5t7c6x1j5k9g0);
		}
		
		var $s = "";
		$s += "<button __q1t7k3u5u5=\"itemOnePageTypeButton\" __a7k3t7I1t2=\""+$x1k3p4t2q6p1x1t2s5.code+"\""+
				" class=\"itemOnePageTypeButton\">"+
				$x1k3p4t2q6p1x1t2s5.code+" - "+$x1k3p4t2q6p1x1t2s5.name+"</button>";
			
		if ($x1k3p4t2q6p1x1t2s5.$x1k3p4t2e8s5I1n4k9 > 0){
			$s += "&nbsp;&nbsp;<span class=\"itemOnePageType-pageCount\">"+
				$x1k3p4t2q6p1x1t2s5.$x1k3p4t2e8s5I1n4k9+"</span>";
		}
		
		if ("node" == $u5o8s5q5t2){
			var j$o = $("[__q1t7k3u5u5='itemOnePageType'][__a7k3t7I1t2='"+$p8j5t7c6x1j5k9g0+"']",scanerSettingBtn);
			j$o.html($s);
			// 注释：点击列表button
			$("[__q1t7k3u5u5='itemOnePageTypeButton']",j$o).on(
				{
					"click":function(){
						$e8k3k9k3t7s5p4t2f9r8I1x1q5k3k9t2a1n4t2(this.getAttribute("__a7k3t7I1t2"));
						return false;
					}
				}
			);
			
			return true;
		}
		
		return $s;
	};
	
	scanerSettingBtn.$p4j5x1j5k9g0u5g5 = function(){
		var $s = "";
//		$s += "<div id=\"ItemDocPagesHelper\"></div>";
		
		$s += "<div id=\"PageTypeSelector\" style=\"height:100%;\">";
		
		var len = Scan.MrPageTypeList.length;
		for (var i = 0;i< len;i++){
			$s += this.$h3k9t2p8a1n4t2(i);
		}
		$s += "</div>";
		//alert($s);
		$("#CatalogerWorkMenuOrA").html($s);
		
		itemCurrentDocPagesHelper();//
    	
		var $h = $(document).height()-$("#WorkMenuSelectOr").outerHeight(true)-$("#ItemDocPagesHelper").outerHeight(true);
		$("#PageTypeSelector").outerHeight($h-$("#ItemCurrentMrs").outerHeight(true)-Scan.ScrollHeight,true);//注释：显示高度设置，否则scrollTop不起作用，无法定位滚动，待优化
		
		$("[__q1t7k3u5u5='itemOnePageType']",window.CatalogerWorkMenuOrA).on(
			{
				"click":function(){
					$k9s5p4p4t7t2e8t7k3u5u5(this,window.PageTypeSelector);//注释：添加选择样式
					
					Scan.PageTypeCode = this.getAttribute("__a7k3t7I1t2");
					$k9f9t2t2h3n4p4x0p1b7k3p4t2k9p1x1t2(this);//注释：点击右侧数字弹出层
				}
			}
		);
		
		$("[__q1t7k3u5u5='itemOnePageTypeButton']",scanerSettingBtn).on(
			{
				"click":function(){
					$e8k3k9k3t7s5p4t2f9r8I1x1q5k3k9t2a1n4t2(this.getAttribute("__a7k3t7I1t2"));
					return false;
				}
			}
		);
	};
	
	return scanerSettingBtn;
}

function itemCurrentDocPagesHelper(){
	var arrayList = Scan.MrDocViewOrBoardList;
	var len = arrayList.length;
	var $q1k3k9k3t7s5p4t2q5e8s5I1n4k9 = 0;
	var $I1n4q1k3k9k3t7s5p4t2q5e8s5I1n4k9 = 0;
	for (var i = 0;i < len;i++){
		if ("99" == arrayList[i].pagename){
			$I1n4q1k3k9k3t7s5p4t2q5e8s5I1n4k9++;
		}else{
			$q1k3k9k3t7s5p4t2q5e8s5I1n4k9++;
		}
	}
	
	var $s = "";
	if ($I1n4q1k3k9k3t7s5p4t2q5e8s5I1n4k9 > 0){
		$s = "<div class=\"itemOneDocPage\"" +
			" style=\"background-color:#76BCB7;\">"+
			"还有<big>"+$I1n4q1k3k9k3t7s5p4t2q5e8s5I1n4k9+"</big>页未归类"+
		"</div>";
	}else if ($q1k3k9k3t7s5p4t2q5e8s5I1n4k9 > 0){
		$s = "<div class=\"itemOneDocPage\"" +
			" style=\"background-color:#D8E8FF;\">"+
			"本文档的页面已全部归类"+
		"</div>";
		if($("#itemOneDoc"+Scan.ItemOneDocID).html().indexOf("/_/img/award_star_gold_3.png")==-1){
			$("#itemOneDoc"+Scan.ItemOneDocID).append("&nbsp;&nbsp;<img title=\"已完成\" src=\"./_/img/award_star_gold_3.png\">");
		}
	}
	
	$("#ItemDocPagesHelper").html($s);
};

// 在调用workMenu之前调用生成相应的数据
function currentDocMrPageTypeNum(){
	var len0 = Scan.MrPageTypeList.length;
	for (var i = 0;i < len0;i++){
		Scan.MrPageTypeList[i].pages = "";
	}
	
	var arrayList = Scan.MrDocViewOrBoardList;
	var len = arrayList.length;
	for (var i = 0;i < len;i++){
		var $x1k3p4t2q6p1x1t2s5 = getb7k3p4t2q6p1x1t2(arrayList[i].pagename);
		//$x1k3p4t2q6p1x1t2s5.pages += arrayList[i]["fileCode"]+",";
		$x1k3p4t2q6p1x1t2s5.pages += arrayList[i].id+",";
	}
	
	for (var i = 0;i < len0;i++){
		var $p4j5s5m5 = Scan.MrPageTypeList[i];
		$p4j5s5m5.$x1k3p4t2w0 = $p4j5s5m5.pages.split(",");//注释：存ID值，归类浏览菜单用
		$p4j5s5m5.$x1k3p4t2e8s5I1n4k9 = $p4j5s5m5.$x1k3p4t2w0.length-1;
		$p4j5s5m5.$x1k3p4t2w0.splice($p4j5s5m5.$x1k3p4t2e8s5I1n4k9,1);
	}
};

function getb7k3p4t2k9p1x1t2s5(pageCode){
	var len = Scan.MrPageTypeList.length;
	for (var i = 0;i < len;i++){
		if (pageCode == Scan.MrPageTypeList[i].code){
			return Scan.MrPageTypeList[i];
		}
	}
	return null;
}

function getb7k3p4t2q6p1x1t2(pageCode){
	return getb7k3p4t2k9p1x1t2s5(pageCode);
}

function getb7k3p4t2q6p1x1t2m7k3p8t2(pageCode){
	var len = Scan.MrPageTypeList.length;
	for (var i = 0;i < len;i++){
		if (pageCode == Scan.MrPageTypeList[i].code){
			return Scan.MrPageTypeList[i].name;
		}
	}
	return "";
}

function $k9s5p4p4t7t2e8t7k3u5u5(scanerSettingBtn,$s5p5n4q1t2u5k9s5f9){
	if (null == scanerSettingBtn){
		return;
	}
	
	var $u5g5k9z8j6m5k9g0 = scanerSettingBtn.className;
	if (isNull($u5g5k9z8j6m5k9g0)){
		return;
	}
	
	if (null == $s5p5n4q1t2u5k9s5f9){
		$s5p5n4q1t2u5k9s5f9 = document.body;
	}
	
	var $q1t7k3u5u5m7k3p8t2 = "";
	var $q1t7k3u5u5m7k3p8t2a1n4 = "";
	
	if ($u5g5k9z8j6m5k9g0.substring($u5g5k9z8j6m5k9g0.length-2) == "On"){
		$q1t7k3u5u5m7k3p8t2 = $u5g5k9z8j6m5k9g0.substring(0,$u5g5k9z8j6m5k9g0.length-2);
		$q1t7k3u5u5m7k3p8t2a1n4 = $u5g5k9z8j6m5k9g0;
	}else{
		$q1t7k3u5u5m7k3p8t2 = $u5g5k9z8j6m5k9g0;
		$q1t7k3u5u5m7k3p8t2a1n4 = $u5g5k9z8j6m5k9g0+"On";
	}
	
	$("."+$q1t7k3u5u5m7k3p8t2a1n4,$s5p5n4q1t2u5k9s5f9).each(
		function(){
			this.className = $q1t7k3u5u5m7k3p8t2;
		}
	);
	
	scanerSettingBtn.className = $q1t7k3u5u5m7k3p8t2a1n4;
}

// 注释：点击右侧数字
function $k9f9t2t2h3n4p4x0p1b7k3p4t2k9p1x1t2($s5m5p4j5h7i3){
	var $j6k9t2p8e8I1f9f9t2n4k9f7s5q1b7k3p4t2u5 = $("#ItemCurrentDocPages")[0];
	if ($j6k9t2p8e8I1f9f9t2n4k9f7s5q1b7k3p4t2u5 != null){
		$j6k9t2p8e8I1f9f9t2n4k9f7s5q1b7k3p4t2u5.parentNode.removeChild($j6k9t2p8e8I1f9f9t2n4k9f7s5q1b7k3p4t2u5);
	}
	
	var arrayList = getp5q1k9h3a7t2b7k3p4t2u5();
	var len = arrayList.length;
	if (len < 1){
		return;
	}
	
	$($s5m5p4j5h7i3).append("<div id=\"ItemCurrentDocPages\"></div>");
	
	var $s = "<div style=\"height:6px;\">&nbsp;</div>";
	for (var i = 0;i < len;i++){
		var saoMiao = arrayList[i];
		$s += "<div class=\"itemOneDocPage\"" +
				" __q1t7k3u5u5=\"itemOneDocPage\"" +
					" __x1k3p4t2j6q5=\""+getNotNullString(saoMiao.id)+"\">"+
			"<table style=\"table-layout:fixed;\"" +
				" cellSpacing=\"0\" cellpadding=\"0\">" +
			"<tr>"+
			
			"<td style=\"width:5em;\">" +
				"<div class=\"itemOneDocPage-code\">"+
					"No."+(getj6n4q5t2q4(saoMiao.id)+1)+
					//saoMiao.fileCode+
					"</div>"+
			"</td>"+
		
			"<td>" +
				"<div class=\"itemOneDocPage-type\" style=\"text-align:right;\">"+
					getMrPageTypeName(saoMiao.pagename)+"</div>"+
			"</td>"+
		
			"</tr>" +
			"</table>"+
		"</div>";
	}
	$("#ItemCurrentDocPages").html($s);
	
	var $h = $($("[__q1t7k3u5u5='itemOneDocPage']",$("#ItemCurrentDocPages")[0])[0]).outerHeight(true);
	$h = Math.min($h*len,300);
	$("#ItemCurrentDocPages").height($h+20);//注释：修改6为20
	
	$("[__q1t7k3u5u5='itemOneDocPage']",$("#ItemCurrentDocPages")[0]).on(
		{
			"click":function(){
				activeDocPageImg(this);
				return false;
			}
		}
	);
	
	$("[__q1t7k3u5u5='itemOneDocPage']",$("#ItemCurrentDocPages")[0]).each(
		function(){
			if (this.getAttribute("__x1k3p4t2j6q5") == Scan.ArmID){
				var $e3k6q6i0o8b7r8f7s5t7t7s5f9s5m5p4j5h7i3 = $("#ItemCurrentDocPages");
				$k9s5p4p4t7t2e8t7k3u5u5(this,$e3k6q6i0o8b7r8f7s5t7t7s5f9s5m5p4j5h7i3[0]);//注释：添加选择样式
				$u5q1f9s5t7t7q6s5x1($(this),$e3k6q6i0o8b7r8f7s5t7t7s5f9s5m5p4j5h7i3);//注释：滚动
			}
		}
	);
};

function getj6n4q5t2q4(fun2_Scan_diaoyong_param){
	var arrayList = Scan.MrDocViewOrBoardList;
	var len = arrayList.length;
	for (var i = 0;i < len;i++){
		if (arrayList[i].id == fun2_Scan_diaoyong_param){
			return i;
		}
	}
	return -1;
};

function getp5q1k9h3a7t2b7k3p4t2u5(){
	var $r = [];
	
	if (isNull(Scan.PageTypeCode)){
		return getp5t7t7b7k3p4t2u5();
	}else{
		var $x1k3p4t2q6p1x1t2s5 = getb7k3p4t2q6p1x1t2(Scan.PageTypeCode);
		var len = $x1k3p4t2q6p1x1t2s5.$x1k3p4t2w0.length;
		for (var i = 0;i < len;i++){
			//$r.push(this.getb7k3p4t2a1n4t2("fileCode",$k9z8p1d6p1d6[i]));
			$r.push(this.getb7k3p4t2a1n4t2("id",$x1k3p4t2q6p1x1t2s5.$x1k3p4t2w0[i]));
		}
	}
	
	return $r;
};

function getp5t7t7b7k3p4t2u5(){
	var $r = [];
	
	var $k9z8p1d6p1d6 = getb7k3p4t2q6p1x1t2u5k6u5t2o5I1t7();
	
	var len = $k9z8p1d6p1d6.length;
	for (var i = 0;i < len;i++){
		var $x1k3p4t2q6p1x1t2s5 = $k9z8p1d6p1d6[i];
		var len_ = $x1k3p4t2q6p1x1t2s5.$x1k3p4t2w0.length;
		for (var ii = 0;ii < len_;ii++){
			$r.push(this.getb7k3p4t2a1n4t2("id",$x1k3p4t2q6p1x1t2s5.$x1k3p4t2w0[ii]));
		}
	}
	
	return $r;
};

function getb7k3p4t2q6p1x1t2(pageCode){
	return getb7k3p4t2k9p1x1t2s5(pageCode);
}

function getb7k3p4t2q6p1x1t2u5k6u5t2o5I1t7(){
	var $r = [];
	var len = Scan.MrPageTypeList.length;
	for (var i = 0;i < len;i++){
		if (isUse(Scan.MrPageTypeList[i].pages)){
			$r.push(Scan.MrPageTypeList[i]);
		}
	}
	return $r;
}

function getb7k3p4t2a1n4t2($u5m7k3p8t2,$u5v8k3t7I1t2){
	var arrayList = Scan.MrDocViewOrBoardList;
	var len = arrayList.length;
	for (var i = 0;i < len;i++){
		if($u5m7k3p8t2 == "id"){
			if (arrayList[i].id == $u5v8k3t7I1t2){
				return arrayList[i];
			}
		}
	}
	return {};
};

function $e8k3k9k3t7s5p4t2f9r8I1x1q5k3k9t2a1n4t2($n4t2h7q6p1x1t2){
	var mrId = Scan.CurrentMrId;
	if (!$k3u5o8f9j6q5(mrId)){
		alert("请指定目标病案!");
		return;
	}
	
	var $x1k3p4t2j6q5 = Scan.ArmID;
	if (isNull($x1k3p4t2j6q5)){
		alert("请先指定目标页!");
		return;
	}
	
	dwr.engine.setAsync(false);//pid ptype
	ScanBiz.catalog(Scan.OrgCode, Scan.CardId, $x1k3p4t2j6q5, $n4t2h7q6p1x1t2, {
		callback:function(){
			var $x1k3p4t2m7s5q5t2 = $k3q1k9h3a7t2b7k3p4t2m7s5q5t2();
			var j$o = $("[__q1t7k3u5u5='docPageType']",$x1k3p4t2m7s5q5t2);
			j$o.html(getMrPageTypeName($n4t2h7q6p1x1t2));
			j$o = $(".docPageUSER-CATALOGUE",$x1k3p4t2m7s5q5t2);
			j$o.html(Scan.Name);
			
			var $k3q1k9h3a7t2a1n4t2 = getp5q1k9h3a7t2b7k3p4t2a1n4t2();
			var $s5t7q5q6p1x1t2 = $k3q1k9h3a7t2a1n4t2.pagename;
			$k3q1k9h3a7t2a1n4t2.pagename = $n4t2h7q6p1x1t2;
			
			currentDocMrPageTypeNum();
			itemCurrentDocPagesHelper();
			
			if (null != $("#CatalogerWorkMenuOrA")[0]){
				CatalogerWorkMenuOrA.$h3n4n4t2f9j6k9t2p8a1n4t2($s5t7q5q6p1x1t2,"node");
				CatalogerWorkMenuOrA.$h3n4n4t2f9j6k9t2p8a1n4t2($n4t2h7q6p1x1t2,"node");
				
				var $o = $("[__q1t7k3u5u5='itemOnePageType'][__a7k3t7I1t2='"+$n4t2h7q6p1x1t2+"']",window.WorkMenuBody)[0];
				$k9s5p4p4t7t2e8t7k3u5u5($o,window.PageTypeSelector);
				
				Scan.PageTypeCode = $o.getAttribute("__a7k3t7I1t2");
				$k9f9t2t2h3n4p4x0p1b7k3p4t2k9p1x1t2($o);////
			}else if (null != $("#CatalogerWorkMenuOrB")[0]){
				var $o = $("[__q1t7k3u5u5='itemOnePageType'][__a7k3t7I1t2='"+$n4t2h7q6p1x1t2+"']",window.WorkMenuBody)[0];
				var $q1s5I1n4k9 = getb7k3p4t2k9p1x1t2s5($n4t2h7q6p1x1t2).$x1k3p4t2e8s5I1n4k9;
				if (0 == $q1s5I1n4k9){$q1s5I1n4k9 = "";}
				$(".itemOnePageType-pageCount",$o).html($q1s5I1n4k9);
				$k9s5p4p4t7t2e8t7k3u5u5($o,window.PageTypeSelector);
				
				var $o = $("[__q1t7k3u5u5='itemOnePageType'][__a7k3t7I1t2='"+$s5t7q5q6p1x1t2+"']",window.WorkMenuBody)[0];
				var $q1s5I1n4k9 = getb7k3p4t2k9p1x1t2s5($s5t7q5q6p1x1t2).$x1k3p4t2e8s5I1n4k9;
				if (0 == $q1s5I1n4k9){$q1s5I1n4k9 = "";}
				$(".itemOnePageType-pageCount",$o).html($q1s5I1n4k9);
			}else{
				var $o = $("[__x1k3p4t2j6q5='"+$x1k3p4t2j6q5+"']",window.ItemCurrentDocPages)[0];
				if (null != $o){
					$(".itemOneDocPage-type",$o).html(getMrPageTypeName($n4t2h7q6p1x1t2));
				}
			}
		},
		warningHandler:function(message){return; },
		errorHandler:function(message){return; }
	})
}

function $k3u5o8f9j6q5($s){
	if (isNull($s)){
		return false;
	}
	
	return true;
}

function getp5q1k9h3a7t2b7k3p4t2a1n4t2(){//alert("ArmID="+Scan.ArmID);
	return this.getb7k3p4t2a1n4t2("id",Scan.ArmID);// 注释：定位红框
};

function catalogerWorkMenuOrB(scanerSettingBtn){
	scanerSettingBtn.$p4j5x1j5k9g0u5g5 = function(){
		var $s = "";
		
//		$s += "<div id=\"ItemDocPagesHelper\"></div>";
		
		$s += "<div id=\"PageTypeSelector\" style=\"height:100%;\">";
		
		var $x1k3p4t2q6p1x1t2u5 = $e8k3k9k3t7s5p4t2f9o8t2n4I1s5f7k3k9k3c6();
		var len = $x1k3p4t2q6p1x1t2u5.length;
		
		this.$x1k3p4t2q6p1x1t2u5 = $x1k3p4t2q6p1x1t2u5;
		
		for (var i = 0;i< len;i++){
			var $x1k3p4t2q6p1x1t2s5 = $x1k3p4t2q6p1x1t2u5[i];
			
			$s += "<div class=\"itemOnePageType\" __q1t7k3u5u5=\"itemOnePageType\"" +
					" __a7k3t7I1t2=\""+$x1k3p4t2q6p1x1t2s5.code+"\" __u5g0=\""+i+"\">"+
				"<span>"+$x1k3p4t2q6p1x1t2s5.__k9h3k9t7t2+"</span>";
				
				var $q1s5I1n4k9 = $x1k3p4t2q6p1x1t2s5.$x1k3p4t2e8s5I1n4k9;
				if (0 == $q1s5I1n4k9){
					$q1s5I1n4k9 = "";
				}
				$s += "&nbsp;&nbsp;<span class=\"itemOnePageType-pageCount\">"+
					$q1s5I1n4k9+"</span>";
			
			$s += "</div>";
		}
		$s += "</div>";
		
		$("#CatalogerWorkMenuOrB").html($s);
		
//		itemCurrentDocPagesHelper();//
    	
		var $h = $(document).height();//-$("#WorkMenuSelectOr").outerHeight(true)-$("#ItemDocPagesHelper").outerHeight(true);
		
    	//$("#CatalogerWorkMenuOr").outerHeight($h-8,true);
		$("#PageTypeSelector").outerHeight($h-Scan.ScrollHeight,true);//注释：显示高度设置，否则scrollTop不起作用，无法定位滚动，待优化
		
		$("[__q1t7k3u5u5='itemOnePageType']",window.CatalogerWorkMenuOrB).on(
			{
				"click":function(){
					$e8k3k9k3t7s5p4t2f9r8I1x1q5k3k9t2a1n4t2(this.getAttribute("__a7k3t7I1t2"));
					$k9s5p4p4t7t2e8t7k3u5u5(this,window.PageTypeSelector);
				}
			}
		);
		
	};
	
	return scanerSettingBtn;
}

function $e8k3k9k3t7s5p4t2f9o8t2n4I1s5f7k3k9k3c6(){
	var $p1d6e3j5p1d6p1d6 = [];
	
	var $x1k3p4t2q6p1x1t2u5k6u5t2o5I1t7 = Scan.MrPageTypeList;
	currentDocb7k3p4t2 = getp5q1k9h3a7t2b7k3p4t2a1n4t2();
	
	var len = $x1k3p4t2q6p1x1t2u5k6u5t2o5I1t7.length;
	for (var i = 0;i< len;i++){
		var $x1k3p4t2q6p1x1t2s5 = $x1k3p4t2q6p1x1t2u5k6u5t2o5I1t7[i];
		//var $k9z8p1d6p1d6 = $x1k3p4t2q6p1x1t2s5.pages.split(",");
		
		$x1k3p4t2q6p1x1t2s5.__u5t5s5f9k9q1I1k9c9t2p1 = $x1k3p4t2q6p1x1t2s5.code;
		
		if (null != currentDocb7k3p4t2.id && 
			currentDocb7k3p4t2.pagename == $x1k3p4t2q6p1x1t2s5.code){
			$x1k3p4t2q6p1x1t2s5.__k9h3k9t7t2 = $x1k3p4t2q6p1x1t2s5.code+" - "+$x1k3p4t2q6p1x1t2s5.name;
			
			$p1d6e3j5p1d6p1d6.$k3x1x1s5h3n4k9t2q5 = i;
		}else{
			$x1k3p4t2q6p1x1t2s5.__k9h3k9t7t2 = $x1k3p4t2q6p1x1t2s5.code+" - "+$x1k3p4t2q6p1x1t2s5.name;
		}
		
		$x1k3p4t2q6p1x1t2s5.__o5I1n4q1k9h3s5n4 = "$e8k3k9k3t7s5p4t2f9r8I1x1q5k3k9t2a1n4t2('"+$x1k3p4t2q6p1x1t2s5.code+"');";
		
		$p1d6e3j5p1d6p1d6.push($x1k3p4t2q6p1x1t2s5);
	}
	return $p1d6e3j5p1d6p1d6;
}

function itemCurrentDocPages(){
	var arrayList = getp5t7t7b7k3p4t2u5();
	var len = arrayList.length;
	var $s = "";
	
	for (var i = 0;i < len;i++){
		var saoMiao = arrayList[i];
		
		$s += "<div class=\"itemOneDocPage\"" +
				" __q1t7k3u5u5=\"itemOneDocPage\"" +
					" __x1k3p4t2j6q5=\""+getNotNullString(saoMiao.id)+"\">"+
			"<span class=\"itemOneDocPage-code\">"+
				"No."+(i+1)+
			"</span>"+
			"&nbsp;&nbsp;&nbsp;&nbsp;"+
			"<span class=\"itemOneDocPage-type\">"+
				getMrPageTypeName(saoMiao.pagename)+"</span>"+
			
			/*
			"<table style=\"table-layout:fixed;\"" +
				" cellSpacing=\"0\" cellpadding=\"0\">" +
			"<tr>"+
			"<td style=\"width:3em;\">" +
				"<div class=\"itemOneDocPage-code\">"+
					//saoMiao.fileCode+
					"No."+(i+1)+
					"</div>"+
			"</td>"+
		
			"<td>" +
				"<div class=\"itemOneDocPage-type\" style=\"text-align:right;\">"+
					getMrPageTypeName(saoMiao.PAGENAME)+"</div>"+
			"</td>"+
		
			"</tr>" +
			"</table>"+
			*/
		"</div>";
	}
	$("#ItemCurrentDocPages").html($s);
	
	itemCurrentDocPagesHelper();////
	
//	var $h = $(window).height()-$("#WorkMenuSelectOr").outerHeight(true);
	var $h = $(document).height()-$("#WorkMenuSelectOr").outerHeight(true)-$("#ItemDocPagesHelper").outerHeight(true);
	$("#ItemCurrentDocPages").outerHeight($h-$("#ItemCurrentMrs").outerHeight(true)-Scan.ScrollHeight,true);//注释：显示高度设置，否则scrollTop不起作用，无法定位滚动，待优化
	
	$("[__q1t7k3u5u5='itemOneDocPage']",$("#ItemCurrentDocPages")[0]).on(
		{
			"mouseup":function(){
				if(event.button == 2){//注释：右键单击 可以弹出层，待完善
					activeDocPageImg(this);
				}else if(event.button == 0 || event.button == 1){//注释：左键单击
					activeDocPageImg(this);
				}
			}
		}
	);
	
	$("[__q1t7k3u5u5='itemOneDocPage']",$("#ItemCurrentDocPages")[0]).each(
		function (){
			if (this.getAttribute("__x1k3p4t2j6q5") == Scan.ArmID){
				$k9s5p4p4t7t2e8t7k3u5u5(this,$("#ItemCurrentDocPages")[0]);
				return false;
			}
		}
	);
};

function mrDocPageTypeOr(){
	if (null == document.getElementById("MrDocPageTypeOr")){
		return;////
	}
	
	var $s = "";
	
	$s += "<div id=\"PageTypeSelector\">";
	
	var $x1k3p4t2q6p1x1t2u5k6u5t2o5I1t7 = getb7k3p4t2q6p1x1t2u5k6u5t2o5I1t7();
	var len = $x1k3p4t2q6p1x1t2u5k6u5t2o5I1t7.length;
	
	for (var i = 0;i< len;i++){
		var $x1k3p4t2q6p1x1t2s5 = $x1k3p4t2q6p1x1t2u5k6u5t2o5I1t7[i];
		
		$s += "<div class=\"itemOnePageType\" __q1t7k3u5u5=\"itemOnePageType\" " +
					"__a7k3t7I1t2=\""+$x1k3p4t2q6p1x1t2s5.code+"\" _i=\""+i+"\">"+
			
			"<table style=\"table-layout:fixed;\"" +
				" cellSpacing=\"0\" cellpadding=\"0\"><tr>"+
		
			"<td>" +
				"<div style=\"text-align:left;\">"+
					//$x1k3p4t2q6p1x1t2s5["CODE_"]+" - "+
					$x1k3p4t2q6p1x1t2s5.name+"</div>"+
			"</td>"+
		
			"<td style=\"width:2em\">" +
				"<div style=\"text-align:right;\">"+$x1k3p4t2q6p1x1t2s5.$x1k3p4t2e8s5I1n4k9+"</div>"+
			"</td>"+
		
			"</tr></table>"+
		"</div>";
	}
	$s += "</div>";
	
	$("#MrDocPageTypeOr").html($s);
	itemCurrentDocPagesHelper();////
	
//	var $h = $(window).height()-$("#WorkMenuSelectOr").outerHeight(true)-$n4I1t7t7q6s5($("#ItemDocPagesHelper").outerHeight(true),0);
	var $h = $(document).height()-$("#WorkMenuSelectOr").outerHeight(true)-$("#ItemDocPagesHelper").outerHeight(true);
	if ("view" == Scan.workType){
		$("#MrDocPageTypeOr").outerHeight($h-$("#ItemCurrentMrs").outerHeight(true)-Scan.ScrollHeight,true);
	}else{
		$("#PageTypeSelector").outerHeight($h-$("#ItemCurrentMrs").outerHeight(true)-Scan.ScrollHeight,true);
	}
	
	$("[__q1t7k3u5u5='itemOnePageType']",window.PageTypeSelector).on(
		{
			"click":function(){
				$k9s5p4p4t7t2e8t7k3u5u5(this,window.PageTypeSelector);
				Scan.PageTypeCode = this.getAttribute("__a7k3t7I1t2");
				//scanerSettingBtn.$k9f9t2t2h3n4p4x0p1b7k3p4t2k9p1x1t2(this);////
				//$o8f9f7s5q1v8h3t2h7a1f9.$e3g5u5g0k9g0q1k7();
				activeDocPageImg(this);
			}
		}
	);
};

function $q5t2t7t2k9t2a1n4t2b7k3p4t2(){
	var $x1k3p4t2j6q5 = Scan.ArmID;
	if (null == $x1k3p4t2j6q5){
		alert("请指定一个目标页！");
		return;
	}
	
	if (!window.confirm("您真的要删除此页吗，请确认！")){
		return;
	}
	
	dwr.engine.setAsync(false);
	ScanBiz.deleteOne($x1k3p4t2j6q5, {
		callback:function(row){
			if(row > 0){
				$q5t2t7t2k9t2a1n4t2($x1k3p4t2j6q5);
			}
		},
		warningHandler:function(message){return; },
		errorHandler:function(message){return; }
	})
};

function $q5t2t7t2k9t2a1n4t2($x1k3p4t2j6q5){
	if ($h3u5j1k3o5t2v8h3t2h7()){
		$p8s5a7t2p5q1k9h3a7t2(1);
		Scan.setMrCount();
		workMenu();
	}else{
		var $x1k3p4t2m7s5q5t2 = this.$k3q1k9h3a7t2b7k3p4t2m7s5q5t2();//temp
		$x1k3p4t2m7s5q5t2.parentNode.removeChild($x1k3p4t2m7s5q5t2);
		
		$p8s5a7t2p5q1k9h3a7t2(-1);
		
		var id = getb7k3p4t2a1n4t2("id",$x1k3p4t2j6q5);
		$f9t2p8s5a7t2b7k3p4t2a1n4t2(id);
		
		Scan.setMrCount();
		workMenu();
	}
};

function $h3u5j1k3o5t2v8h3t2h7(){
	if ("view_ItemCurrentDocPages" == this.$q1I1f9f9t2n4k9o6s5f9d1o8t2n4I1){
		if ("thumbnail" != Scam.Mode){
			return true;
		}
	}
	return false;
};

function $f9t2p8s5a7t2b7k3p4t2a1n4t2(fun2_Scan_diaoyong_param){
	var arrayList = Scan.MrDocViewOrBoardList;
	var len = arrayList.length;
	for (var i = 0;i < len;i++){
		if (arrayList[i] == fun2_Scan_diaoyong_param){
			arrayList.splice(i,1);
			$("#CurrentTotalPagecount").text(""+arrayList.length);
			break;
		}
	}
};

function deleteWendang(){
	var mrId = Scan.CurrentMrId;
	
	if (!$k3u5o8f9j6q5(mrId)){
		alert("请指定一个目标病案！");
		return;
	}
	
	if (!window.confirm("您真的要删除病案文档目录"+mrId+"吗，请确认！")){
		return;
	}
	
	dwr.engine.setAsync(false);
	ScanBiz.deleteDoc(Scan.OrgCode, mrId, {
		callback:function(row){
			if(row > 0){
				alert(mrId+"文档目录删除成功！");
				$s5x1t2n4f7s5q1r8(mrId, 1);
			}else{
				alert("删除"+mrId+"文档目录失败！");
			}
		},
		warningHandler:function(message){alert("删除"+mrId+"文档目录失败！:\r\n"+message); return;},
		errorHandler:function(message){alert("删除"+mrId+"文档目录失败！:\r\n"+message); return;}
	})
}

function $f9t2u5h3w0h3n4p4($mode){
	var j$q3s5k3f9q5 = $("#MrDocViewOrBoard");
	var $q3s5k3f9q5 = this.j$q3s5k3f9q5[0];
	
	var $h3p8p4m7s5q5t2 = this.$k3q1k9h3a7t2b7k3p4t2j6p8p4m7s5q5t2();
	
	var j$m1i3j6m5f9c6 = $($h3p8p4m7s5q5t2);
	
	var $h = j$m1i3j6m5f9c6.height();
	var $w = j$m1i3j6m5f9c6.width();
	
	if ("+" == $mode){
		$h = parseInt($h*1.25);
		$w = parseInt($w*1.25);
	}else if("-" == $mode){
		$h = parseInt($h/1.25);
		$w = parseInt($w/1.25);
	}
	
	var $j6m5k9z8h7i3n4g0 = j$q3s5k3f9q5.width()-(j$q3s5k3f9q5.outerWidth(true)-j$q3s5k3f9q5.width())-6;
	if ($w >= $j6m5k9z8h7i3n4g0){
		alert("已经是最大尺寸了！");
		return false;
	}
	
	var $j6m5u5g0u5g5n4g0 = j$q3s5k3f9q5.width()-($(j$q3s5k3f9q5[0].parentNode).outerWidth(true)-j$q3s5k3f9q5.width());
	$j6m5u5g0u5g5n4g0 = parseInt($j6m5u5g0u5g5n4g0/3 - 30);
	if ($w <= $j6m5u5g0u5g5n4g0){
		alert("已经是最小尺寸了！");
		return false;
	}
	$u5t2k9a1f9o8s5q5t2($w+","+$h);////
	Scan.Mode = $w+","+$h;// 注释：设置变大变小
	getDocPageSpan_up();	
	return true;
}

function geta1f9o8s5q5t2(){
	return getFromCookie("MediDocumenterOrMode");
};

function $u5t2k9a1f9o8s5q5t2($mode){
	setCookie("MediDocumenterOrMode",$mode,732);//732:day
};

function $f9s5k9k3k9t2($q5t2p4f9t2t2){
	currentDocb7k3p4t2 = getp5q1k9h3a7t2b7k3p4t2a1n4t2();
	var $o5h3t7t2k6f9t7 = currentDocb7k3p4t2.fileUrl;
	
	ScanBiz.rotate(currentDocb7k3p4t2.id, "rotate", $q5t2p4f9t2t2, $o5h3t7t2k6f9t7, {
		callback:function(flag){
			if ("SUCCESS" != flag){
				alert("提交失败!"); return;
			}else{
				$s5x1t2n4f7s5q1r8(Scan.CurrentMrId, 1);// 注释：判定连续扫描，强制刷新数据
			}
		},
		warningHandler:function(message){alert("提交失败!"); return; },
		errorHandler:function(message){alert("提交失败!"); return; }
	})
	
	return true;
};

function $o5t7h3x1r8o5t7s5x1($u5o8s5q5t2){
	currentDocb7k3p4t2 = getp5q1k9h3a7t2b7k3p4t2a1n4t2();
	var $o5h3t7t2k6f9t7 = currentDocb7k3p4t2.fileUrl;
	
	ScanBiz.flipFlop(currentDocb7k3p4t2.id, $o5h3t7t2k6f9t7, $u5o8s5q5t2, {
		callback:function(flag){
			if ("SUCCESS" != flag){
				alert("提交失败!"); return;
			}else{
				$s5x1t2n4f7s5q1r8(Scan.CurrentMrId, 1);// 注释：判定连续扫描，强制刷新数据
			}
		},
		warningHandler:function(message){alert("提交失败!"); return; },
		errorHandler:function(message){alert("提交失败!"); return; }
	})
	
	return true;
}

function $f9t2a1f9h3p4h3n4(){
	currentDocb7k3p4t2 = getp5q1k9h3a7t2b7k3p4t2a1n4t2();
	
	ScanBiz.reOrigin(currentDocb7k3p4t2.id, {
		callback:function(flag){
			if ("SUCCESS" != flag){
				alert("提交失败!"); return;
			}else{
				$s5x1t2n4f7s5q1r8(Scan.CurrentMrId, 1);// 注释：判定连续扫描，强制刷新数据
			}
		},
		warningHandler:function(message){alert("提交失败!"); return; },
		errorHandler:function(message){alert("提交失败!"); return; }
	})
	
	return true;
}